package com.smiier.skin;

import android.app.Application;

import com.evan.common.connection.ConnectionCommon;
import com.evan.common.share.ShareQQUtils;
import com.evan.common.share.ShareWXUtils;
import com.evan.common.share.ShareWeiboUtils;
import com.evan.common.utils.ImageUtils;
import com.smiier.skin.util.GlobalSettings;
import com.smiier.skin.utils.DBUtil;
import com.smiier.skin.utils.FilesUtil;

public class SkinApp extends Application {

	protected static SkinApp application;

	@Override
	public void onCreate() {
		super.onCreate();

		GlobalSettings.sApp4Doctor = true;

		application = this;
		FilesUtil.createDir();
		ConnectionCommon.getInstance()
				.setRequestPath(GlobalSettings.SERVER_URL);
		ConnectionCommon.getInstance().setRequestPicPath(
				GlobalSettings.SERVER_IMG_URL);
		// ConnectionCommon.getInstance().setRequestPath(
		// "http://www.xn--ekrq20ff8a10ftsl.net/");
		// ConnectionCommon.getInstance().setRequestPicPath(
		// "http://www.xn--ekrq20ff8a10ftsl.net/mfpic/");
		ShareWXUtils.setWXAPPID(GlobalSettings.WEIXIN_APP_ID);
		ShareWXUtils.setWXAPPSECRET(GlobalSettings.WEIXIN_APP_SECRET);
		ShareQQUtils.setQQAPPID(GlobalSettings.QQ_APP_ID);
		ShareWeiboUtils.setWeiboAPPID(GlobalSettings.WEIBO_APP_KEY);
		// Thread.setDefaultUncaughtExceptionHandler(new
		// GlobalUncaughtExceptionHandler(
		// this));
		ImageUtils.yasuo = 720 * 1280;
	}

	@Override
	public void onTerminate() {
		DBUtil.getInstance(this).release();
		super.onTerminate();
	}

	public SkinApp getInstance() {
		return application;
	}

}
